{php include wl_template('common/header');}
<ul class="nav nav-tabs">
    <li><a href="{php echo web_url('dating/vip/vipList')}">会员卡列表</a></li>
    <li class="active"><a href="javascript:;">{if $id}编辑{else}添加{/if}会员卡</a></li>
</ul>
<div class="app-content">
    <div class="app-form">
        <div class="panel panel-default">
            <form class="form-horizontal form-validate" method="post">
                <div class="form-group">
                    <label class="col-sm-2 control-label">会员卡标题<span class="must-fill">*</span></label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" required name="data[title]" value="{$info['title']}" maxlength="20"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">价格<span class="must-fill">*</span></label>
                    <div class="col-sm-9">
                        <input class="form-control" type="number" required name="data[money]" value="{$info['money']}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">类型</label>
                    <div class="col-sm-9">
                        <label class="radio-inline">
                            <input type="radio" name="data[type]" value="1" {if $info['type'] != 2}checked="checked"{/if}> 时限卡
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="data[type]" value="2" {if $info['type'] == 2}checked="checked"{/if}> 次数卡
                        </label>
                        <div class="help-block">在有效时间内可以查看任意用户的信息，时限结束后不可再次查看。达到时间限制则会员卡过期</div>
                        <div class="help-block">消耗次数查看任意用户的信息，无时间限制，消耗次数后可永久查看该用户信息。次数消耗完毕则会员卡过期</div>
                    </div>
                </div>
                <div class="form-group {if $info['type'] == 2}hide{/if}" id="day">
                    <label class="col-sm-2 control-label">有效时间<span class="must-fill">*</span></label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input class="form-control" type="number" required name="data[day]" value="{$info['day']}"/>
                            <span class="input-group-addon">天</span>
                        </div>
                        <div class="help-block">为0则不限制</div>
                    </div>
                </div>
                <div class="form-group {if $info['type'] != 2}hide{/if}" id="second">
                    <label class="col-sm-2 control-label">次数<span class="must-fill">*</span></label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input class="form-control" type="number" required name="data[second]" value="{$info['second']}"/>
                            <span class="input-group-addon">次</span>
                        </div>
                        <div class="help-block">为0则不限制</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="number" required name="data[sort]" value="{$info['sort']}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-9">
                        <input type="hidden" name="token" value="{$_W['token']}" />
                        <input type="hidden" name="id" value="{$id}" />
                        <input type="submit" name="submit" value="提交" class="btn btn-primary col-sm-1 min-width" />
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    /**
     * 修改会员卡类型
     */
    $(document).on("change","[name='data[type]']",function (){
        let type = $("[name='data[type]']:checked").val();
        //会员卡类型:1=时限卡,2=次数卡
        if(type == 1) {
            $("#day").removeClass("hide");
            $("#second").addClass('hide');
        }else{
            $("#day").addClass("hide");
            $("#second").removeClass('hide');
        }
    });
</script>
{php include wl_template('common/footer');}
